﻿using Microsoft.Office.Server.Search.Query;
using Microsoft.Office.Server.Search.WebControls;
using Microsoft.SharePoint.Utilities;
using Microsoft.SharePoint.WebPartPages;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;

namespace SPSearchAsYouTypeWP.SearchBoxAsYouType
{
    class SearchUXMonitoredScope : SPMonitoredScope
    {
        private WebPart CurrentWebPart;

        private bool IsUITime = true;

        private string MethodName = string.Empty;

        internal SearchUXMonitoredScope(WebPart webpart, string name)
            : this(webpart, name, true)
        {
        }

        internal SearchUXMonitoredScope(WebPart webpart, string name, bool isUITime)
            : base(name)
        {
            this.CurrentWebPart = webpart;
            this.IsUITime = isUITime;
            this.MethodName = name;
        }

        protected override void OnDisposing()
        {
            try
            {
                if (HttpContext.Current != null)
                {
                    Page handler = HttpContext.Current.Handler as Page;
                    if (handler != null)
                    {
                        ScriptApplicationManager current = ScriptApplicationManager.GetCurrent(handler);
                        SPExecutionTimeCounter monitor = base.GetMonitor<SPExecutionTimeCounter>();
                        
                    }
                }
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                
            }
            base.OnDisposing();
        }
    }
}
